﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;
namespace LINQ
{
    class Program
    {
        
        static void Main(string[] args)
        {
            NorthwindEntities northwind = new NorthwindEntities();
            ObjectResult<Category> categories = northwind.GetCategories();
            ObjectResult<Product> products = northwind.GetProducts();
            ObjectResult<Order> orders = northwind.GetOrders();
            ObjectResult<Order_Detail> orderDetails = northwind.GetOrderDetails();
            ObjectResult<CustomerDemographic> customerDemographics = northwind.GetCustomerDemographics();
            ObjectResult<Customer> customers = northwind.GetCustomers();
            ObjectResult<Employee> employees = northwind.GetEmployees();
            ObjectResult<Region> regions = northwind.GetRegions();
            ObjectResult<Shipper> shippers = northwind.GetShippers();
            ObjectResult<Supplier> suppliers = northwind.GetSuppliers();
            ObjectResult<Territory> territories = northwind.GetTerritories();

            //ObjectResult<Category> categorieResults;
            //ObjectResult<Product> productResults;
            //ObjectResult<Order> orderResults;
            //ObjectResult<Order_Detail> orderDetailResults; 
            //ObjectResult<CustomerDemographic> customerDemographicResults;
            //ObjectResult<Customer> customerResults;  
            //ObjectResult<Employee> employeeResults; 
            //ObjectResult<Region> regionResults;
            //ObjectResult<Shipper> shipperResults;
            //ObjectResult<Supplier> supplierResults;
            //ObjectResult<Territory> territorieResults;

            var categorieResults = from s in categories where s.CategoryID == 8 select s;
                                                //select new { s.CategoryID, s.CategoryName };




            foreach (var item in categorieResults)
            {
                Console.WriteLine(string.Format("CategoryID: {0} CategoryName: {1}", item.CategoryID, item.CategoryName));
            }



























            Console.ReadKey();
        }

        //List<Category> categories = northwind.GetCategories().ToList<Category>();
        //List<Product> products = northwind.GetProducts().ToList<Product>();
        //List<Order> orders = northwind.GetOrders().ToList<Order>();
        //List<Order_Detail> orderDetails = northwind.GetOrderDetails().ToList<Order_Detail>();
        //List<CustomerDemographic> customerDemographics = northwind.GetCustomerDemographics().ToList<CustomerDemographic>();
        //List<Customer> customers = northwind.GetCustomers().ToList<Customer>();
        //List<Employee> employees = northwind.GetEmployees().ToList<Employee>();
        //List<Region> regions = northwind.GetRegions().ToList<Region>();
        //List<Shipper> shippers = northwind.GetShippers().ToList<Shipper>();
        //List<Supplier> suppliers = northwind.GetSuppliers().ToList<Supplier>();
        //List<Territory> territories = northwind.GetTerritories().ToList<Territory>();

        //List<Category> categorieResults;
        //List<Product> productResults;
        //List<Order> orderResults;
        //List<Order_Detail> orderDetailResults;
        //List<CustomerDemographic> customerDemographicResults;
        //List<Customer> customerResults;
        //List<Employee> employeeResults;
        //List<Region> regionResults;
        //List<Shipper> shipperResults;
        //List<Supplier> supplierResults;
        //List<Territory> territorieResults;
    }
}
